#pragma once

#ifdef _DD_LineCap_
#define DD_LineCap_Mode __declspec(dllexport)
#else
#define DD_LineCap_Mode __declspec(dllimport)
#endif 

////////////////////////////////////////////////////////
#ifndef _DD_LineCap_
#ifdef _DEBUG   
#pragma comment(lib, "LineCapMand.lib") 
#else
#pragma comment(lib, "LineCapMan.lib")
#endif
#endif 

#include "DD_CapCfg.h"
#include "DD_ImgCfg.h"

class xhLineCap;
class DD_LineCap_Mode DD_LineCap
{
public:
	DD_LineCap(void);
	~DD_LineCap(void);

public:
	//init
	int Initialize();
	//
	int UnInitialize();

public:
	int SearchCapture();
	//get the capture device name
	int GetCaptureList(zkCapDevDesc **ppDescs,int &nCount);

public:
	//parent hwnd
	int SetMainHwnd(HWND hWnd,GUID *pGuid=NULL);
	int RegOnDrawCallBack(OnDrawCallBackFun funCallBack,void *pContext);
	int RegCapMsgCallBack(CapMsgCallBackFun funCallBack,void *pContext);

public:
	int SetCacheSize(int nCacheSize = 100*1024*1024);

public:
	//select capture device 
	int SelectCapture(zkCapDevDesc *pDesc);

public:
	//set capture parameter,zkFCaptureParam
	int OpCaptureParam(void *pVoid);
	//
	int GetImageSize(int &nWidth,int &nHeight);
	//
	int GetImageInfo(zkImgBitInfo **ppImgBitInfo);

public:
	int SetCapLineCount(int nLineSize = -1); //

public:
	//start 
	int StartCapture();
	//stop 
	int StopCapture();
	//draw data
	int	Draw(void *pVoid = NULL);
	//get the capture image data, need call UnLock
	int GetImageData(zkImgBitInfo **ppImgBitInfo);
	//get histogram information, need call UnLock
	int GetLiveHistogramInfo(void **ppHistogram);
	//
	int GetGrayValue(int x,int y,DWORD &dwGray);


public:
	int SelectBadPixelFile(char *pFileName);
	//select the Line revise file
	int SelectReviseFile(char *pFileName,int nCreateRevise = 0 );

public:
	int CreateBadPixelRevise(void *pVoid=NULL);
	int SetBadPixelReviseGrade(int nGrade);
	int SaveBadPixelReviseFile(char *pFileName);
	int GetBadPixelValue(int x,int y,DWORD &dwValue);
	int SetBadPixelValue(int x,int y,DWORD dwValue);

public:
	int CreateRevise(void *pVoid=NULL);
	int SetReviseGrade(int nGrade);
	int SaveReviseFile(char *pFileName);

public:
	int SetRecordParam(void *pVoid = NULL);
	int StartRecord(char *pFileName);
	int StopRecord();


private:
	xhLineCap  *m_pxhLineCap;
};
